package com.easyedu.teacher.dao;

import com.easyedu.core.entity.po.OpenCourse;
import com.easyedu.core.entity.po.StudentSelect;
import com.easyedu.core.entity.po.Teacher;
import com.easyedu.teacher.entity.query.CommitGradeQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author lmr
 **/
@Mapper
public interface TeacherDao {

    /**
     * 功能描述:通过教师序号获取教室信息
     *
     * @param teacherNumber 1 教师编号
     * @return : com.easyedu.api.entity.DO.Teacher
     **/
    @Select("select * from teacher where teacher_number = #{teacherNumber}")
    Teacher getInformation(Long teacherNumber);

    /**
     * 功能描述:获取教师所教课程
     *
     * @param teacherId    1 教授教师id
     * @param openYear     2 开放年份
     * @param openSemester 3 开放学期
     * @return : com.easyedu.api.entity.DO.OpenCourse
     **/
    @Select("select * from open_course where teacher_id = #{teacherId} AND open_year = #{openYear} AND semester = #{openSemester}")
    List<OpenCourse> getTeachCourse(Long teacherId, int openYear, String openSemester);

    /**
     * 功能描述: 教师录入学生成绩并提交到教务处
     *
     * @param course 1 成绩提交数据
     * @return : java.lang.Integer
     **/
    Integer updateGrade(CommitGradeQuery course);

    /**
     * 功能描述:查看所教课程成绩
     *
     * @param openCoursesId 1 开放课程唯一id
     * @return : java.util.List<com.easyedu.api.entity.DO.StudentSelect>
     **/
    @Select("select student_number,student_name,course_number,course_name, usual_score,experiment_score,exam_score," +
            "total_score,is_commit from student_select where open_courses_id = #{openCoursesId}")
    List<StudentSelect> getCourseGrade(Long openCoursesId);

}
